@extends('layouts.app')

@section('content')
<div class="container" style="margin:55px auto;overflow-x:hidden;">
    <div class="row">
        <div class="col-xs-12" style="padding:0">
            <div class="panel panel-default">
                <div class="panel-heading textIndent">重置密码</div>

                <div class="panel-body">
                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}">
                        {{ csrf_field() }}

                        <input type="hidden" name="token" value="{{ $token }}">

                        <div class="form-group{{ $errors->has('mobile') ? ' has-error' : '' }}">
                            <label for="mobile" class="col-md-4 control-label">手机号码</label>

                            <div class="col-md-6">
                                <input id="mobile" type="tel" class="form-control" name="mobile" value="{{ $mobile or old('mobile') }}" required autofocus>

                                @if ($errors->has('mobile'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('mobile') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>
                        
                        <div class="form-group{{ $errors->has('verifyCode') ? ' has-error' : '' }}">
                            <label for="verifyCode" class="col-md-4 control-label ">验证码</label>

                            <div class="col-md-6">
                                <div class="input-group" style="width:100%">
                                <input id="verifyCode" type="verifyCode" placeholder="" class="form-control col-md-10" style="width:60%;" name="verifyCode" value="{{ old('verifyCode') }}" required>
                                <button type="button"  id="sendVerifySmsButton" class=" btn btn-info form-control" style="width:40%;background:#e62f17;border:1px solid #e62f17;" >获取验证码</button>
                                </div>
                                @if ($errors->has('verifyCode'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('verifyCode') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label for="password" class="col-md-4 control-label">密码</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control" name="password" required>

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                            <label for="password-confirm" class="col-md-4 control-label">确认密码</label>
                            <div class="col-md-6">
                                <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>

                                @if ($errors->has('password_confirmation'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password_confirmation') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>
                        
                        <div class="form-group{{ $errors->has('luotest_response') ? ' has-error' : '' }}">
                            <!-- <label for="password-confirm" class="col-md-4 control-label">人机验证</label> -->

                            <div class="col-md-6">
                                <div class="l-captcha" data-site-key="7c0aab865141ce6f89cf3f9a5431f42f"></div>
                                @if ($errors->has('luotest_response'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('luotest_response') }}</strong>
                                    </span>
                                @endif
                            </div>
                            
                        </div>

                        <script src="//captcha.luosimao.com/static/dist/api.js"></script>


                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary btn-block" style="background:#e62f17;border:0;">
                                    重置密码
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1"  role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content" style="padding:5px 0;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="padding-right:5px;">&times;</button>
                
            </div>
            <div class="modal-body"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

@endsection
@section('js')
<script src="{{ asset('js/laravel-sms.js') }}"></script>
<script>
$('#sendVerifySmsButton').sms({
    //laravel csrf token
    token       : "{{csrf_token()}}",
    //请求间隔时间
    interval    : 60,
    //请求参数
    requestData : {
        //手机号
        mobile : function () {
            return $('input[name=mobile]').val();
        },
        //手机号的检测规则
        mobile_rule : 'mobile_required'
    }
});
</script>
@endsection